import re

import requests

doubai_url = 'https://movie.douban.com/top250?start=0&filter='

headers = {
    'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36'
}


response = requests.get(url=doubai_url, headers=headers)
# print(response.text)
content = response.text
# result = re.findall(r'<div class="pic">.*?href="(.*?)".*?alt="(.*?)" src="(.*?)"',content)
items = re.findall(
    r'<div class="pic">.*?<a href="(.*?)".*?<img.*?alt="(.*?)".*?src="(.*?)"',
    content,
    re.DOTALL
)
# print(items)
# link_url = result[0]
# name = result[1]
# img = result[2]
# print(link_url)
for item in items:
    link_url = item[0]
    name = item[1]
    img_url = item[2]
    # print(link_url)
    # print(name)
    # print(img_url)